/**
 *  by tangjk
 */

window.CardLove = window.CardLove || {};

/**
 * 分数score对象
 */
CardLove.score = function(){

    //当前角色的分数
    this.sc = 0;

    //最大分数
    this.maxScore = 6;

    //最小分数
    this.minScore = 0;


};

/**
 * 分数加1
 */
CardLove.score.prototype.plus = function(){
    if(this._isLessScore(this.maxScore)) return;
    this.sc++;
};


/**
 * 分数减1
 */
CardLove.score.prototype.sub = function(){
    if(this._isLessScore(this.minScore)) return;
    this.sc--;
};


/**
 * 分数清零
 */
CardLove.score.clear = function(){
    this.sc = 0;
};


/**
 *  获取当前角色的分数
 */
CardLove.score.prototype.getScore = function(){
    return this.sc;
};

/**
 *  （内部函数）判断是否小于指定分数
 */
CardLove.score.prototype._isLessScore = function(s){
    if(s || this.sc > s) return false;
    return true;
};

CardLove.score.initScore = function(){
    return new CardLove.score();
}